Skip to content

Simplify _WT_ROOT to a constant defaulting to ~/.wt#17

Merged
guodong-sq merged 4 commits intomainfrom
simplify/wt-root-constant
Feb 13, 2026
Merged

Simplify _WT_ROOT to a constant defaulting to ~/.wt#17
guodong-sq merged 4 commits intomainfrom
simplify/wt-root-constant

Conversation

@guodong-sq
Copy link
Copy Markdown
Collaborator

@guodong-sq guodong-sq commented Feb 12, 2026

Summary

Supersedes #15.

Test plan

  • Open a new iTerm tab from home directory, verify echo "$_WT_ROOT" shows ~/.wt
  • Run wt switch, wt list, etc. — confirm all commands work
  • Test dev override: _WT_ROOT=$PWD source ./wt.sh && echo "$_WT_ROOT"
  • All 168 BATS tests pass

Replace the fragile _WT_SCRIPT_PATH detection and _wt_resolve_root
resolution with a simple constant. The previous approach was
susceptible to multiple shell-specific issues (zsh $0 returning
"-zsh", zsh command cd not changing subshell directory) that caused
_WT_ROOT to resolve to the shell's startup cwd.

Since install.sh always installs to ~/.wt/, hardcoding the default
is both simpler and more reliable. _WT_ROOT can still be overridden
before sourcing for development use.
@guodong-sq guodong-sq merged commit 0d07049 into main Feb 13, 2026
4 checks passed
@guodong-sq guodong-sq deleted the simplify/wt-root-constant branch March 10, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant